<?php include_once($_SERVER['DOCUMENT_ROOT']."/controller/common/common_setting_unit.php"); ?>








<?php
$_REQUEST['ai_belong']=$_REQUEST['sys_part'];
//todo 做个判空，读取旧数据的sys-part
//todo 做个判空，读取旧数据的sys-part
//todo 做个判空，读取旧数据的sys-part
//todo 做个判空，读取旧数据的sys-part
//todo 做个判空，读取旧数据的sys-part
$system_part    = addslashes($_REQUEST ['sys_part']);
$new_detail_nid = addslashes($_REQUEST['nid']);




//传递过来的页面信息。返回的时候，会根据这些信息返回原来的页面
$nowpageid      = addslashes($_REQUEST['nowpageid']);
$sortby         = addslashes($_REQUEST['sortby']);
$term_nid       = addslashes($_REQUEST['term_nid']);


$old_detail=select_one_line_all_items($table_Prefix."detail","nid = ".$_REQUEST['nid']);

?>


<?
$table        = $table_Prefix . "detail";
$sort_by      = "nid";
$sort_order   = "desc";
?>




<?php

//这里是涉及上传文件的部分：包含图片和附件。视频也应该用这种形式上传
//20220315同时把旧的文件，移动到delete中。
//统一设置一下保存图片的路径
$_uf['path']        = ROOT_PATH_ . "/uploadfiles/".$theme_folder."/";

//创建删除文件存放文件夹
if(!file_exists($_uf['path'] ."/delete/")){
mkdir($_uf['path'] ."/delete/",0777,true);
chmod($_uf['path'] ."/delete/",0777);
}


//上传icon
if (is_uploaded_file($_FILES['icon']['tmp_name']))
{
$_uf['upfile']       = $_FILES['icon'];
$_info               = upload_file($_uf);
$_REQUEST['ai_icon'] = $_info['name'];
if(($_REQUEST['ai_icon'])&&($old_detail['icon']!="alpha.gif"))
{
rename($_uf['path'].$old_detail['icon'], $_uf['path'] ."delete/".$old_detail['icon']);
}
}

//上传Banner
if (is_uploaded_file($_FILES['banner']['tmp_name']))
{
$_uf['upfile']       = $_FILES['banner'];
$_info               = upload_file($_uf);
$_REQUEST['ai_banner'] = $_info['name'];
if(($_REQUEST['ai_banner'])&&($old_detail['banner']!="alpha.gif")){
rename($_uf['path'].$old_detail['banner'], $_uf['path'] ."delete/".$old_detail['banner']);
}
}


    //上传 extend_img
    if (is_uploaded_file($_FILES['extend_img']['tmp_name']))
    {
        $_uf['upfile']       = $_FILES['extend_img'];
        $_info               = upload_file($_uf);
        $_REQUEST['ai_extend_img'] = $_info['name'];
        if(($_REQUEST['ai_extend_img'])&&($old_detail['extend_img']!="alpha.gif")){
            rename($_uf['path'].$old_detail['extend_img'], $_uf['path'] ."delete/".$old_detail['extend_img']);
        }
    }



?>





<?
//设置需要搜索的表格的前缀后缀
$table = $table_Prefix . "detail";
$sqlstr=update_date($table,$_REQUEST,'nid',$_REQUEST['nid']);
//echo $sqlstr;
sql_log($sqlstr);
$query = mysql_query($sqlstr) or die ("error:".mysql_error());
mysql_close($con);

?>






<script type="text/javascript">
    alert("输入信息已保存，点击确认返回继续操作.");
    document.location.href = "detail-list.php?nowpageid=<? echo $nowpageid ?>&sortby=<? echo $sortby?>&nid=<? echo $term_nid ?>&sys_part=<? echo $system_part ?>&nav_l2=detail-list"
</script>
